// 清除对象中值是 null 或 undefined 的属性
export function clearObject(obj: object | undefined) {
  if (!obj) {
    return {};
  }
  const result = { ...obj };
  Object.keys(result).forEach((key) => {
    const value = result[key];
    if (value === null || value === undefined) {
      delete result[key];
    }
  });
  return result;
}
